<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Edit Server - SmartWebHook</title>
    {{template "widgets/headfile.html" .}}
</head>
<body>
{{template "widgets/head.html" .}}
<div class="container">
    <div class="bs-docs-container">
        <form method="post" action='{{urlfor "ServerController.Edit"}}' id="serverForm">
        <input type="hidden" name="id" value="{{.Model.ServerId}}">
        <div class="title">
            <h3>Edit Server </h3>
            <hr>
        </div>
        <div class="body">


            <div class="row">
                <div class="col-lg-3">
                    <div class="form-group">
                        <label>Server Name</label>
                        <input type="text" name="name" id="serverName" placeholder="Server Name" class="form-control" value="{{.Model.Name}}">
                    </div>
                </div>
                <div class="col-lg-3">
                    <div class="form-group">
                        <label for="serverIp">Server Ip</label>
                        <input type="text" name="ip" id="serverIp" placeholder="Server IP" class="form-control" value="{{.Model.IpAddress}}">
                    </div>
                </div>
                <div class="col-lg-3">
                    <div class="form-group">
                        <label for="serverPort">Server SSH Port</label>
                        <input type="text" name="port" id="serverPort" placeholder="Port" class="form-control" value="{{.Model.Port}}">
                    </div>
                </div>
                <div class="col-lg-3">
                    <div class="form-group">
                        <label for="serverPort">Server SSH Account</label>
                        <input type="text" name="account" id="serverAccount" placeholder="Account" class="form-control" value="{{.Model.Account}}">
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-8">
                    <div class="form-group">
                        <label for="serverTag">Tag <span class="text">(多个标签请用英文的“,”分割)</span></label>
                        <input type="text" name="tag" id="serverTag" placeholder="Tag" class="form-control" value="{{.Model.Tag}}">
                    </div>
                </div>
                <div class="col-lg-2">
                    <div class="form-group">
                        <label for="serverType">Server Type</label>
                        <select name="type" id="serverType" class="form-control">
                            <option value="ssh" {{if eq .Model.Type "ssh"}}selected{{end}} >SSH</option>
                            <option value="client" {{if eq .Model.Type "client"}}selected{{end}} >Client</option>
                        </select>
                    </div>
                </div>
                <div class="col-lg-2">
                    <div class="form-group">
                        <label>Status</label>
                        <div>
                            <label>
                                <input type="radio" name="status" value="0" {{if eq .Model.Status 0}}checked{{end}}> 启用
                            </label>
                            <label>
                                <input type="radio" name="status" value="1" {{if eq .Model.Status 1}}checked{{end}}> 禁用
                            </label>
                        </div>

                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="form-group">
                        <label for="serverKey">SSH Private Key / Account Password</label>
                        <textarea class="form-control" name="key" id="serverKey" placeholder="SSH Private Key / Account Password">{{.Model.PrivateKey}}</textarea>
                    </div>
                </div>
            </div>

        </div>
        <div class="body-botton text-center">
            <span class="text" style="padding-right: 15px;" id="errorMessage"></span>

            <a href='{{urlfor "ServerController.Index"}}' class="btn btn-success btn-sm">Back Server List</a>
            <button id="saveServerBtn" type="submit" class="btn btn-info btn-sm" data-load-text="saving">Save Changes</button>

        </div>
        </form>
    </div>
</div>
{{template "widgets/foot.html" .}}
</body>
</html>